package com.itany.corejava.day05;

import java.util.Arrays;

public class Test5 {

    public static void main(String[] args) {

        int[] a=new int[5];

        a[0]=1;
        a[1]=2;
        a[2]=4;
        a[3]=5;

        int n=3;

        int i=3;

        while(i!=-1&&n<a[i]){
            a[i+1]=a[i];
            i--;
        }
        a[i+1]=n;

        System.out.println(Arrays.toString(a));//[1,2,3,4,5]


    }


}
